<template>
	<view>
		<!-- <view class="global-title">订单详情</view>
		 -->
		 <tab-title :tabTitle='title'></tab-title>
		<view class="order-header ">
			<view class="container flex justify-between">
				<view>订单状态</view>
				<view>
					<text class="text-black" v-if="status==0">待支付</text>
					<text class="text-black" v-if="status==1">待发货</text>
					<text class="text-black" v-if="status==2">待评价</text>
					<text class="text-black" v-if="status==3">已完成</text>
					<text class="text-black" v-if="status==4">退货/款</text>
				</view>
			</view>
		</view>
		<view class="order-msg" v-if="">
			<view class="container">
				<view class="action top">
					<text class="cuIcon-title text-green"></text>
					<text>订单信息</text>
				</view>
				<view><text>订单号&emsp;&nbsp;:&nbsp;{{orderNo}}</text></view>
				<view><text>发单时间&nbsp;:&nbsp;{{detail.createYearMonthDay}}&emsp;{{detail.createHousMint}}</text></view>
			</view>
		</view>
		<view class="order-msg ">
			<view class="container">
				<view class="action top">
					<text class="cuIcon-title text-green"></text>
					<text>商品信息</text>
				</view>
				<block v-for="item in detail.listResult" :key="item.name">
					<view><text>商品名称&nbsp;:&nbsp;{{item.commodityName}}</text></view>
					<view><text>数量&emsp;&emsp;&nbsp;:&nbsp;5份</text></view>
				</block>
			</view>
		</view>
		<view class="order-msg" style="border: 0px;">
			<view class="container">
				<view class="action top">
					<text class="cuIcon-title text-green"></text>
					<text>商品总价</text>
				</view>
				<view><text>应付&emsp;&emsp;&nbsp;:&nbsp;￥{{detail.orderPrice}}</text></view>
				<view>
					<text>实付&emsp;&emsp;&nbsp;:</text>
					<text style="color: #ff3b3b; margin-left: 10upx;">￥{{detail.orderPrice}}</text>
					<text style="margin-left: 20upx; line-height:93upx;">(含优惠{{detail.couponPrice}}元)</text>
				</view>
			</view>
		</view>
	
	</view>
</template>

<script>
export default {
		data() {
			return {
				detail:{},
				id:'',
				status:'',
				orderNo:'',
				title:'订单详情'
			};
		},
		onLoad(options) {
			console.log(options)
			if(!uni.getStorageSync('userInfo')){
				uni.redirectTo({
					url:'/pages/login/login'
				})
			}else{
				this.getDetail(options.id)
				this.id = options.id;
				this.status = options.status;
				this.orderNo=options.orderNo
			}
		},
		methods:{
			getDetail(id){
				let userInfo = uni.getStorageSync('userInfo')	
				this.$http.post('assemble/businessOrder/selectOrderDetail',{
					storeId:userInfo.storeId,
					id
				}).then((res)=>{
					this.detail=res.data.obj;
					console.log(res)
				}).catch((err)=>{
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.order-header {
	margin-top: 25upx;
	height: 100upx;
	background-color: #f3f3f3;
	.container {
		width: 718upx;
		margin: 0 auto;
		line-height: 100upx;
		view:nth-child(1) {
			color: $global-bgc;
			font-size: $font30;
		}
		view:nth-child(2) {
			color: #333333;
			font-size: $font30;
		}
	}
}
.order-msg {
	font-size: $font30;
	line-height: 93upx;
	border-bottom: 10upx solid #eeeeee;
	.container {
		width: 718upx;
		margin: 0 auto;
		.top {
			width: 718upx;
			height: 93upx;
			line-height: 93upx;
			border-bottom: 1upx solid #eeeeee;
			margin-left: 5upx;
		}
		[class*='cuIcon-'] {
			color: $global-bgc;
		}
	}
}
.banner-scroll{
	width: 50%;
}
</style>
